package com.chuanjiabao.wisdom.util.dialog;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;

import com.chuanjiabao.wisdom.R;
import com.chuanjiabao.wisdom.databinding.DialogHomeFileRelevantOperationBinding;
import com.chuanjiabao.wisdom.listener.OnBHClickListener;

public class HomeFilesRelevantOperationDialog extends BaseDialog {

    Context context;
    DialogHomeFileRelevantOperationBinding binding;
    OnBHClickListener onBHClickListener;

    public HomeFilesRelevantOperationDialog(Context context) {
        super(context);
        this.context = context;
        binding = DataBindingUtil.inflate(
                LayoutInflater.from(context),
                R.layout.dialog_home_file_relevant_operation,
                null,
                false
        );
        binding.setDialog(this);
        binding.tvModuleCancel.setOnClickListener(v -> dismiss());
        setContentView(binding.getRoot());
        WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
        layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
        layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
        getWindow().setAttributes(layoutParams);
        getWindow().setGravity(Gravity.BOTTOM);
    }

    public void setOnBHClickListener(OnBHClickListener onBHClickListener) {
        this.onBHClickListener = onBHClickListener;
    }

    public void noPoint(View view) {
        if (onBHClickListener != null) {
            onBHClickListener.onCloseClick();
        }
        dismiss();
    }

    public void okPoint(View view) {
        if (onBHClickListener != null) {
            onBHClickListener.onConfirmClick();
        }
        dismiss();
    }

}

